#include <iostream>
using namespace std;

int function(int n){
    if(n <= 3)return 1;
    int* result = new int[n];
    result[0] = 1;
    result[1] = 1;
    result[2] = 1;
    for(int i = 3;i < n;i++)
        result[i] = 2*result[i-1] + 3*result[i-1] + result[i-3];
    return result[n-1];
}

int main(){
    int n = 4;
    cout << function(n) << endl;
    return 1;
}